<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        document.write("for循环实现10的阶乘:<br>");
        for(var i=1;i<=10;i++){
                var sum=1;
                for(var j=1;j<=i;j++){ 
                    sum*=j
                }
            document.write(i,"的阶乘为：",sum);
            document.write("<br>");
        }
        document.write("<br>");

        document.write("while循环实现10的阶乘:<br>");
        var i=1;
        while(i<=10){
                var sum=1;
                var j=1;
                while(j<=i){
                    sum*=j;
                    j++;
                }
            document.write(i,"的阶乘是：",sum);
            document.write("<br>");
            i++;
        }
        document.write("<br>");

        document.write("do-while循环实现10的阶乘：<br>");
        var i=1;
        do{
            var j=1;
            var sum=1;
            do{
                sum*=j;
                j++;
            }
            while(j<=i)
            document.write(i,"的阶乘为：",sum);
            document.write("<br>");
            i++;
        }
        while(i<=10)

    </script>
</head>
<body>
    
</body>
</html>